package storageManager;
import java.io.IOException;
import java.io.RandomAccessFile;


public abstract class FileClass {//This class have the methods that all my file classes(system catalog, index, data) use.
	public RandomAccessFile raf;//The random access object. This class makes it available for us to read from and write to a file.
	//public TableRecord tableRecord;
	public double size() throws IOException{//Returns the size of a file in bytes as double.
		return (double) raf.length();
	}
	public int numberOfPages() throws IOException{//Returns the number of pages in a file. (Every page has a size of 512 bytes)
		return (int) Math.ceil((size()/512));
	}
	public abstract void createAPage() throws IOException;//Every file should have these methods.
	public abstract Record byteToRecord(byte[] bytes);
	public abstract Page byteToPage(int pageNumber) throws IOException;
}
